
CROSS_COMPILE = 
AS		= $(CROSS_COMPILE)as
LD		= $(CROSS_COMPILE)ld
CC		= $(CROSS_COMPILE)gcc
CPP		= $(CC) -E
AR		= $(CROSS_COMPILE)ar
NM		= $(CROSS_COMPILE)nm

STRIP		= $(CROSS_COMPILE)strip
OBJCOPY		= $(CROSS_COMPILE)objcopy
OBJDUMP		= $(CROSS_COMPILE)objdump

export AS LD CC CPP AR NM
export STRIP OBJCOPY OBJDUMP

CFLAGS := -Wall -O2 -g
CFLAGS += -I$(shell pwd)/include -I$(shell pwd)/algorithm -I$(shell pwd)/mysql -I$(shell pwd)/plugins -I$(shell pwd)/workfun -I/usr/include/mysql

#LDFLAGS := -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lm -lrt -latomic -lssl -lcrypto -ldl -pthread
LDFLAGS := -L/usr/lib/arm-linux-gnueabihf  -lmariadbclient -pthread -lz -lm -ldl

export CFLAGS LDFLAGS

TOPDIR := $(shell pwd)
export TOPDIR

TARGET := netServer

obj-y += algorithm/
obj-y += mysql/
obj-y += server/
obj-y += workfun/
obj-y += plugins/

all : 
	make -C ./ -f $(TOPDIR)/Makefile.build
	$(CC) $(LDFLAGS) -o $(TARGET) built-in.o


clean:
	rm -f $(shell find -name "*.o")
	rm -f $(TARGET)

distclean:
	rm -f $(shell find -name "*.o")
	rm -f $(shell find -name "*.d")
	rm -f $(TARGET)
	